#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1e7+10;

typedef long long ll;

int prime[MAXN],cnt,phi[MAXN],n;
bool f[MAXN];
ll s[MAXN],ans;

void shai(){
	phi[1] = 1;
	for(int i = 2;i <= n;i++){
		if(!f[i]){
			prime[++cnt] = i;
			phi[i] = i-1;
		}
		for(int j = 1;j <= cnt && prime[j] * i <= n;j++){
			f[prime[j] * i] = 1;
			if(i % prime[j] == 0){
				phi[i * prime[j]] = phi[i] * prime[j];
				break;
			}else{
				phi[i * prime[j]] = phi[i] * phi[prime[j]];
			}
		}
	}
	for(int i = 1;i <= n;i++) s[i] = s[i-1] + phi[i];
}

int main (){
	scanf("%d",&n);
	shai();
	for(int i = 1;i <= cnt;i++) ans += 2*s[n/prime[i]]-1;
	printf("%lld\n",ans);
	return 0;
}
